#pragma once

#include "d3d9.h"
#include "d3dx9.h"
#include <stdio.h>		// required for sprintf_s
#include "SpriteManager.h"

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
#pragma comment (lib, "winmm.lib")


class TimerBar
{
private:
	// Pointer to SpriteManager
	SpriteManager*		m_pSpriteManager;

	// Singleton instance
	static TimerBar*	m_TimerBarInstance;

	short sEnergyBarFull;
	short sEnergyBar1;
	short sEnergyBar2;
	short sEnergyBar3;
	short sEnergyBar4;
	short sEnergyBar5;
	short sEnergyBar6;
	short sEnergyBar7;
	short sEnergyBar8;
	short sEnergyBar9;
	short sEnergyBar10;
	// Checkpoint variable
	short sCheckpointEnergy;

	LONG				lStartTime; // for getting timer count
	LONG				lCurrentTime; // for getting timer count
	int					iTimer;  // internal time tracking
	short				sEnergyBarPiece; //saves sprite that we want to render

public:
	TimerBar(void);
	~TimerBar(void);
	
	short sEnergyBarEmpty;

	// Singleton functions
	static TimerBar* GetInstance(void);
	void DeleteTimerBarInstance(void);

	void Initialize(void);
	void LoadTimerBar(bool bLevelLoad);
	void Update(int iModelCount, int iPreLoadedModels);
	void DamageTaken(void);
	int  CheckTime();
	void SetCheckpoint(void);
	void ResetTime();
	void FullEnergy();
	void Render(void);

	// Shutdown function
	void DestroyTimer(void);
};